<script>
/* 快速排序 */
function QuickSort(arr) {
	let len = arr.length;
	if(len < 1) return [];
	if(len == 1) return arr;

	let mid = len>>1;
	let leftArr = [],
		rightArr = [];
	for(let i = 0; i < len; i++) {
		if(mid == i) continue;
		if(arr[mid] >= arr[i]) {
			leftArr.push(arr[i]);
		} else {
			rightArr.push(arr[i]);
		}
	}

	return [...QuickSort(leftArr), arr[mid], ...QuickSort(rightArr)]
}

let arr = [1, 4, 2, 3, 6, 5, 100, 99, 88, 89];
let res = QuickSort(arr);
console.log(res);
</script>